package sdfi.lee.Listener;

import java.util.Timer;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import sdfi.lee.Entity.Task;
import sdfi.lee.Logger.MyLogger;
import sdfi.lee.Timer.MyTimerTask;

/**
 * Application Lifecycle Listener implementation class AddRListener
 *
 */
public class AddRListener implements ServletContextListener {

    /**
     * Default constructor. 
     */
	private MyTimerTask task=null;
	private Timer timer=null;
    public AddRListener() {
        // TODO Auto-generated constructor stub
    }

	/**
     * @see ServletContextListener#contextInitialized(ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent arg0) {
        // TODO Auto-generated method stub
    	timer=new Timer();
    	task=new MyTimerTask();
    	MyLogger.Logger("用户订阅更新监听器启动......", null, "");
    	timer.schedule(task,0,60*60*1000);
    
    	
    }

	/**
     * @see ServletContextListener#contextDestroyed(ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0) {
        // TODO Auto-generated method stub
    	timer.cancel();
    }
	
}
